#include <iostream>
#include <sstream>
#include <string>
using std::cout;
using std::endl;
using std::ostringstream;
using std::string;

void test0(){
    int num = 123, num2 = 456;
    ostringstream oss;
    //把所有的内容都传给了字符串输出流对象
    oss << "num = " << num << " , num2 = " << num2 << endl;
    /* &(oss.str());//error */
    string res = oss.str();
    cout << res;

    cout << endl;
    string str1("hello");
    cout << &str1 << endl;
    cout << &(str1.append(",world")) << endl;
    cout << str1 << endl;
    str1.append("!wangdao").append(",").append(std::to_string(num));
    cout << str1 << endl;

    cout << endl;
    string str2("open");
    /* &(str2 + ",file" + ",filename"); */

}

int main(void){
    test0();
    return 0;
}
